//
//  UIBarButtonItem+Extension.m
//  微博
//
//  Created by yate1996 on 15-6-2.
//  Copyright (c) 2015年 yate1996. All rights reserved.
//

#import "UIBarButtonItem+Extension.h"

#import "UIView+Extension.h"


@implementation UIBarButtonItem (Extension)


+(UIBarButtonItem *)itemWithImageName:(NSString *)imageName highImageName:(NSString *)highImageName target:(id)target action:(SEL)action{
    
    UIButton *button = [[UIButton alloc]init];
    [button setBackgroundImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    
    [button setBackgroundImage:[UIImage imageNamed:highImageName] forState:UIControlStateHighlighted];
    
    button.size = button.currentBackgroundImage.size;
    
    
    [button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    
    return [[UIBarButtonItem alloc]initWithCustomView:button];
    

}

@end
